#include "Fighter.h"

Fighter::Fighter(void)
{
}

Fighter::~Fighter(void)
{
}

void Fighter::Load()
{
	msprite.Load("fighter.png");
}

void Fighter::Unload()
{
	msprite.Unload();
}
void Fighter::Update(float deltaTime)
{
	const float kSpeed = 300.0f;
	if(Input_IsKeyDown(Keys::RIGHT))
	{
		mposition.x += kSpeed * deltaTime;
	}
	else if(Input_IsKeyDown(Keys::LEFT))
	{
		mposition.x -=  kSpeed * deltaTime;
	}
	if(Input_IsKeyDown(Keys::DOWN))
	{
		mposition.y +=  kSpeed * deltaTime;
	}
	else if(Input_IsKeyDown(Keys::UP))
	{
		mposition.y -=  kSpeed * deltaTime;
	}
	
}
void Fighter::Render()
{
	int width = msprite.GetWidth();
	int height = msprite.GetHeight();
	SVector2 offset(width * 0.5f, height *0.5f);
	SVector2 renderPosition = mposition - offset;	// use render position in the setposition

	msprite.SetPosition(renderPosition);
	msprite.Render();
}